package com.hsylient.springboot.controller;

import cn.hutool.core.bean.BeanUtil;
import com.hsylient.springboot.entity.Student;
import com.hsylient.springboot.response.StudentResponse;
import com.hsylient.springboot.service.StudentService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
public class StudentController {

    private final StudentService studentService;

    @GetMapping("/v3/find/student")
    public StudentResponse findStudentById(@RequestParam Long id) {
        Student student = studentService.findById(id);
        return BeanUtil.copyProperties(student, StudentResponse.class);
    }
}
